package com.douma._2022_6_30;

import java.util.Scanner;

/**
 * 抖码算法，让算法学习变的简单有趣
 *
 * @作者 : 老汤
 */
public class 检查是否存在满足条件的数字组合 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }

        int[] res = new int[3];
        boolean hasFound = false;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) continue;
                for (int k = 0; k < n; k++) {
                    if (i == k || j == k) continue;

                    if (nums[i] == nums[j] + 2 * nums[k]) {
                        res[0] = nums[i];
                        res[1] = nums[j];
                        res[2] = nums[k];
                        hasFound = true;
                        break;
                    }
                }
                if (hasFound) break;
            }
            if (hasFound) break;
        }
        if (hasFound) {
            System.out.println(String.format("%d %d %d", res[0], res[1], res[2]));
        } else {
            System.out.println(0);
        }
        sc.close();
    }
}
